package com.lzy.crm.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.lzy.crm.base.mybatis.BaseMapper;
import com.lzy.crm.base.mybatis.Example;
import com.lzy.crm.base.page.PageQuery;
import com.lzy.crm.base.service.BaseServiceImpl;
import com.lzy.crm.dao.DictMapper;
import com.lzy.crm.dao.criteria.DictCriteria;
import com.lzy.crm.domain.Dict;
import com.lzy.crm.service.DictService;

@Service("dictService")
public class DictServiceImpl extends BaseServiceImpl<Dict, DictCriteria> implements DictService {

	@Resource
	private DictMapper dictMapper;
	
	@Override
	public BaseMapper<Dict, DictCriteria> getBaseMapper() {
		return dictMapper;
	}

	
	/**
	 * 分页查询字典信息
	 * @param dictType
	 * @param dictName
	 * @param pageQuery
	 * @return
	 */
	public List<Dict> getDictList(String dictType,String dictName,PageQuery pageQuery){
		return dictMapper.getDictList(dictType, dictName, pageQuery);
	}
	
	/**
	 * 查询字典类型
	 * @param dictType
	 * @return
	 */
	public List<Dict> getDictListByDictType(String dictType){
		Example<DictCriteria> example = new Example<DictCriteria>(DictCriteria.class);
		DictCriteria dictCriteria = example.createCriteria();
		dictCriteria.andDictTypeEqualTo(dictType);
		return dictMapper.getListByExample(example);
		
	}
	
}
